package com.itic.mall.system.productfeedback.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.itic.appbase.framework.common.service.CrudService;
import com.itic.mall.system.order.persistence.dao.OrderDao;
import com.itic.mall.system.order.persistence.model.Order;
import com.itic.mall.system.orderproducts.persistence.dao.OrderProductsDao;
import com.itic.mall.system.orderproducts.persistence.model.OrderProducts;
import com.itic.mall.system.product.persistence.dao.ProductDao;
import com.itic.mall.system.product.persistence.model.Product;
import com.itic.mall.system.productfeedback.persistence.dao.ProductFeedbackDao;
import com.itic.mall.system.productfeedback.persistence.model.ProductFeedback;
import com.itic.mall.system.productfeedback.persistence.model.ProductFeedbackExample;


@Service
@Transactional
public class ProductFeedbackService
     extends CrudService<ProductFeedbackDao,ProductFeedback,ProductFeedbackExample> {
	@Autowired
	private OrderDao orderDao;
	@Autowired
	private OrderProductsDao orderProductsDao;
    @Autowired
    private ProductFeedbackDao productFeedbackDao;
    @Autowired
    private ProductDao productDao;
    

	public String addAndUpdateProduct(Order order,OrderProducts orderProducts,ProductFeedback feedback, Product product) {
		if(null!=order){
			orderDao.updateByPrimaryKeySelective(order);
		}
		orderProductsDao.updateByPrimaryKeySelective(orderProducts);
		productDao.updateByPrimaryKeySelective(product);
		productFeedbackDao.insertSelective(feedback);
		return SUCCESS;
	}


}